#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#define MAX_LED 4

int main(void){
    GPIO_InitTypeDef GPIO_InitStruct;
    uint16_t val = 0x0001;
    uint8_t count = 0;
    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3;
    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
    GPIO_Init(GPIOA,&GPIO_InitStruct);
    
    while(1){
        GPIO_Write(GPIOA, ~val);//low-level driving
        val = val<<1;
        count++;
        if(count >=MAX_LED){
            val = 0x0001;
            count = 0;
        }
        Delay_ms(100);
    }
}
